home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_02
/
8n02045a
< prev
next >
Wrap
Text File
|
1990-02-28
|
3KB
|
87 lines
*****Listing 1*****
Class Graphical Object
Graphical Object is an abstract class. There will never
be any instances of this class. Classes Circle and
Square are subclasses of this class.
Graphical Object data:
y position
x position
Graphical Object methods:
INITIALIZE
Starting y position
Starting x position
DRAW
Only implemented by subclasses
MOVE
Arguments:
Increment in the y direction
Increment in the x direction
Send the draw black message to the object (erase
the object).
Modify the x and y position of the object per
the arguments passed to the MOVE method.
Send the draw white message to the object.
Class Circle
Circle is a subclass of class Graphical Object.
Circle data (in addition to Graphical Object data):
radius of the circle
Circle methods:
INITIALIZE
Arguments:
Starting y position
Starting x position
Radius
Send the INITIALIZE message to class Graphical
Object
Store the size in the Circle data.
Send the DRAW message to the Circle.
DRAW
Argument:
Color of the circle to be drawn.
Draw the circle on the screen.
MOVE
Inherited from the class Graphical Object.
Class Square
Square is a subclass of class Graphical Object.
Square data:
the length of a side of the square
Square methods:
INITIALIZE
Arguments:
Starting y position
Starting x position
Radius
Send the INITIALIZE message to class Graphical
Object
Store the size in the Square data.
Send the DRAW message to the Square.
DRAW
Argument:
Color of the square to be drawn.
Draw the square on the screen.
MOVE
Inherited from the class Graphical Object.
Class Double_circle
Class Double_circle is a subclass of class Circle.
Double_circle data:
Same a for a Circle.
Double_circle methods:
INITIALIZE
Inherited from class Circle.
DRAW
Argument:
Color of the Double_circle to be drawn.
Draw a circle on the screen.
Draw a slightly smaller concentric circle on the
screen.
MOVE
Inherited from class Circle.